package de.revdev.llt.module.utility;

import java.util.ResourceBundle;
import javax.enterprise.inject.Produces;
import javax.faces.context.FacesContext;
import javax.inject.Inject;

public class ResourceBundleProducer {

    private FacesContext fc;

    @Inject
    public void setFacesContext(FacesContext facesContext) {
        this.fc = facesContext;
    }

    @Produces
    @MessageBundle
    public ResourceBundle getResourceBundle() {
        return ResourceBundle.getBundle(fc.getApplication().getMessageBundle(), fc.getViewRoot().getLocale());
    }
}
